﻿using TheWorldLibrary.Items;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using TheWorldLibrary.Sprites;

namespace TheWorldLibrary.Characters
{
    public class Character
    {
        #region Field Region

        private Entity entity;
        private AnimatedSprite sprite;

        // Armor fields

        private GameItem head;
        private GameItem body;
        private GameItem hands;
        private GameItem feet;

        // Weapon/Shield fields

        private GameItem mainHand;
        private GameItem offHand;
        private int handsFree;

        #endregion

        #region Property Region

        public Entity Entity
        {
            get { return entity; }
            set { entity = value; }
        }

        public AnimatedSprite Sprite
        {
            get { return sprite; }
            set { sprite = value; }
        }

        // Armor properties

        public GameItem Head
        {
            get { return head; }
            set { head = value; }
        }

        public GameItem Body
        {
            get { return body; }
            set { body = value; }
        }

        public GameItem Hands
        {
            get { return hands; }
            set { hands = value; }
        }

        public GameItem Feet
        {
            get { return feet; }
            set { feet = value; }
        }

        // Weapon/Shield properties

        public GameItem MainHand
        {
            get { return mainHand; }
            set { mainHand = value; }
        }

        public GameItem OffHand
        {
            get { return offHand; }
            set { offHand = value; }
        }

        public int HandsFree
        {
            get { return handsFree; }
            set { handsFree = value; }
        }

        #endregion

        #region Constructor Region

        public Character(Entity entity, AnimatedSprite sprite)
        {
            this.entity = entity;
            this.sprite = sprite;
        }

        public Character()
        {

        }

        #endregion

        #region Method Region
        #endregion

        #region Virtual Method region

        public virtual void Update(GameTime gameTime)
        {
            entity.Update(gameTime.ElapsedGameTime);
            sprite.Update(gameTime);
        }

        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            sprite.Draw(gameTime, spriteBatch);
        }

        public virtual bool Equip(GameItem gameItem)
        {
            bool success = false;

            return success;
        }

        public virtual bool Unequip(GameItem gameItem)
        {
            bool success = false;

            return success;
        }

        #endregion
    }
}
